package fr.univ.surveyonline.model;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.appengine.api.datastore.Key;


@PersistenceCapable(identityType = IdentityType.DATASTORE)
public class ContraintesEntities {
	// ATTRIBUTS
	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Key key;
	
	@Persistent
	private Integer minimum;
	
	@Persistent
	private Double pourcent;
	
	@Persistent
	private int ordinal;
	
	@Persistent
	private Key surveyKey;

	public ContraintesEntities(Object o) {
		this.ordinal = Contraintes.ordinal(o);
	}
	
	// METHODES
	public Key getKey() {
		return key;
	}

	public Integer getMinimum() {
		return minimum;
	}

	public void setMinimum(Integer minimum) {
		this.minimum = minimum;
	}

	public Double getPourcent() {
		return pourcent;
	}

	public void setPourcent(Double pourcent) {
		this.pourcent = pourcent;
	}

	public int getOrdinal() {
		return ordinal;
	}

	public Key getSurveyKey() {
		return surveyKey;
	}
	
	public void setSurveyKey(Survey s) {
		surveyKey = s.getKey();
	}
}
